package com.geekteam.masterenglish.utils;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.ObjectInputStream;

import android.content.Context;
import android.util.Log;

public class StorageUtil {
	private static String CONFIG = "equalizer.DAT";

	public static int readConfig(Context ctx) {
		int value = 0;
		try {
			File file = ctx.getFileStreamPath(CONFIG);
			if (file.exists()) {
				FileInputStream fis = null;

				fis = ctx.openFileInput(CONFIG);

				ObjectInputStream ois = new ObjectInputStream(fis);
				value = ois.readInt();
				ois.close();
			}
		} catch (FileNotFoundException e) {
			Log.e("error", e.getMessage());
		} catch (Exception e) {
			Log.e("error", e.getMessage());
		}
		
		return value;
	}
}
